﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Linq;
using System.Linq;
using System.Text;
using Bon.It.Server.Interfaces;
using Bon_It.Model;

namespace Bon.It.Server
{
    /// <summary>
    /// Base clase, only for references the service host.
    /// </summary>
    public partial class ContractManager: IContract
    {
        public DataContextDataContext GetDataContext()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            var context= new DataContextDataContext(connectionString);
            context.DeferredLoadingEnabled = false;
            return context;
        } 

        public DataContextDataContext GetDataContext(DataLoadOptions dlo)
        {
            var context= GetDataContext();
            context.LoadOptions = dlo;
            return context;
        }
    }
}
